package com.niuwa.p2p.action.fundmanager;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import com.niuwa.p2p.action.JsonAction;
import com.niuwa.p2p.entity.fund.BaseAccount;
import com.niuwa.p2p.entity.fund.CustAccount;
import com.niuwa.p2p.entity.fund.CustAcctRule;
import com.niuwa.p2p.service.fund.FundAccountService;
/**
 * 处理资金客户账户设置
 * @author money
 *
 */
@Namespace("/custmanager")
@Controller
public class CustAction  extends JsonAction{
	private static final long serialVersionUID = 1L;
	
	private FundAccountService fundAccountService;
	
	private BaseAccount baseAccount;
	private CustAccount custAccount;
	private CustAcctRule custAcctRule;
	public BaseAccount getBaseAccount() {
		return baseAccount;
	}
	public void setBaseAccount(BaseAccount baseAccount) {
		this.baseAccount = baseAccount;
	}
	public CustAccount getCustAccount() {
		return custAccount;
	}
	public void setCustAccount(CustAccount custAccount) {
		this.custAccount = custAccount;
	}
	public CustAcctRule getCustAcctRule() {
		return custAcctRule;
	}
	public void setCustAcctRule(CustAcctRule custAcctRule) {
		this.custAcctRule = custAcctRule;
	}
	
	@Action("updateCustAccount")
	public String updateCustAccount(){
		custAccount.setAccountNo(baseAccount.getAcctNo());
		boolean result = fundAccountService.updateCustAccount(baseAccount,custAccount, custAcctRule);
		if(result){
			this.setResult(true, "更改成功!", null);
		}else{
			this.setResult(true, "更改失败!", null);
		}
		return NONE;
	}
	
	
	
}
